home *** CD-ROM | disk | FTP | other *** search
- Operations on scaffold lines:
-
- 1 Use another character's scaffold lines as the base for the character
- 2 Create new local scaffold line
- 3 Create new global scaffold line, which will appear in all current descendants
- 4 Override an existing line with a new (local) definition
- - new definition can be thick, L-tangent, R-tangent
- 5 Take existing line and adjust its position
- 6 Associate a point/set of points with a scaffold line
- 7 Link one scaffold line to another
-
- 1: Right-drag character into skeleton window.
- The destination character inherits all scaffold lines from the source,
- losing any of its own in the process. This link is remembered, so that
- the lines actually reside in the source character, and any alterations made
- in either character will be reflected in the other.
-
- 2: Menu: scaffold.local.h/u/d/v/l/r creates a new local line of the
- appropriate type. The line is displayed in light blue rather than dark
- blue, to show that it originates in this character, rather than being
- inherited from another. No other character has the line in it initially,
- but right-dragging the character onto another will cause the new line to be
- inheritied along with all the others.
-
- 3: Menu: scaffold.global.h/u/d/v/l/r creates a new global line of the
- appropriate type. The difference between this and the previous operation is
- that the line is immediately inherited by any characters which depend on the
- current character (and on any which depend on them, and so on). The
- operation is only possible if there is a free line index which is not used
- in the current character or any of its descendants.
-
- 4: Select line to be overridden, then Menu: scaffold.replace.h/u/d/v/l/r.
- The existing line is replaced by the new one, and is used in any descendants of the character.
-
- 5: Drag line.
- All characters containing the line are redrawn, and any bitmaps which
- depend on the characters are also updated.
-
- 6: Select scaffold line, then click points to be altered.
- Alternatively drag a rectangle around the points and release.
-
- 7: Select scaffold line, then SHIFT-SELECT on the control point of another line.
- The second line is linked to the first. A 'linear' link can be set up by using CTRL-SELECT.
-
-
- Data Structures
- -------------
-
- In character definition, 1 byte to indicate index into list of scaffold entries:
-
- Scaffold structure (just after font header):
-
- 1 byte: link onto next scaffold entry (base scaffold for this set)
- 1 byte: 8 bits indicating which x-scaffold entries are held in the base set
- 1 byte: 8 bits indicating which y-scaffold entries are held in the base set
- 1 byte: 8 bits indicating which x-scaffold entries are being overridden
- 1 byte: 8 bits indicating which y-scaffold entries are being overridden
- 3 bytes: 2-bytes: bits 0..11 = signed coordinate (lower one if this is a thick scaffold line)
- bits 12..14 = scaffold link index (0 if none)
- bit 15 = 'linear' link bit
- 1-byte unsigned thickness (if this is a thick line)
- 254 ==> this is an L-tangent line
- 255 ==> this is an R-tangent line
-
- The number of 3-byte entries following the initial 5-byte header depends on
- how may bits are set in bytes 3 and 4. Lines without a bit set in bytes 1,2
- or 3,4 are deleted.
-
- With up to 16 local lines per char, max data size = (16*3+5)*192 = 10176 bytes!
-
-
- Problem:
-
- For a given character, work out where each of x[0..7] and y[0..7] scaffold lines are.
-
- Solution:
-
- Use bit arrays xb[0..7] and yb[0..7] initially all clear
- Set x[] and y[] for the local lines, setting the appropriate bits
- If not all bits are set, look up the definition for the 'base' character
- For all local lines in that, if the bit is clear, set the x[] or y[] line and set the bit
- Continue by taking that char's base char until all bits are set.
-
- So we need to be able to look up the set for a char relatively quickly
-
- In the editor
- -----------
-
- For each character, x/ychar[0..7] = code of character containing the local definition of the line
- For the local lines, x/ycoord[0..7] = position of line
- x/ywidth[0..7] = width of line - only if x/ychar[] = this char code
-
- Thus when a line is dragged, all other characters containing that line can be updated too.
- (1) work out which char holds the local definition
- (2) update any displayed chars with that line also held in the same base char.
-
- The actual coordinate and width of the line are only stored in one place,
- since all others have a char code reference instead.
-
- When a char's definition is altered (or added to), any other chars which
- depend on that character also receive the results of the change. To avoid
- unpleasant surprises any deleted/undefined lines in the character are deemed
- to be deleted (local) lines in the new char, so if new lines are created in
- the old char, they do not suddenly appear in the new char.
-
- Note that when a char's scaffold set is dragged into another char, the
- latter's local scaffold lines are lost (since the line index numbers cannot
- be readily predicted). Also, any new lines added to the definition of the
- base char will not be seen in the new char (although alterations made to the
- existing set will affect both characters).
-
- Updates
- -------
-
- Copying a char's set into another:
-
- x/ychar[] copied from the base char - except for deleted lines, where x/ychar[] = new char
- x/ycoord[] copied - &8000 ==> deleted
- x/ywidth[] copied - 254, 255 are special
-
- Creating a new scaffold line:
-
- If a line is selected, that is replaced by the new line
- If no line selected, a free index is seached for (ie. one whose line is currently deleted.
- If no more free lines are available, error message tells you to select a line you don't need.
- The new line is always local to the character.
-
- Dragging a scaffold line:
-
- New lines can ONLY affect the character to which they belong - if the line
- did not previously exist, then any chars using that as a base will have a
- LOCAL deleted line instead.
-
- So when dragging a line one must search for chars in the font which have a
- reference to the line, and update them - those which are displayed will be
- updated immediately, while the others are done when the line is dropped.
-
- Loading/saving the font file
-
- The scaffold lines are packed and unpacked as required - after the first
- unpacking (when the file is first loaded) the unpacked form is treated as
- the master definition, but the packed form is left lying around in the file
- for convenience when saving.
-